prime number program in javascript using for loop